package com.pxxy.yuyi.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pxxy.yuyi.dao.AdminDao;
import com.pxxy.yuyi.entity.Admin;
import com.pxxy.yuyi.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by IntelliJ IDEA
 *
 * @Author : XuWen
 * @create 2021/6/21 11:09
 */
@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminDao adminDao;

    @Override
    public PageInfo<Admin> selectAll(Integer pageNum) {
        PageHelper.startPage(pageNum,6);
        List<Admin> list=adminDao.selectAll();
        return new PageInfo<Admin>(list);
    }

    @Override
    public Integer deleteAdmin(Integer id) {
        return adminDao.deleteAdmin(id);
    }

    @Override
    public Integer addAdmin(Admin admin) {
        return adminDao.addAdmin(admin);
    }

    @Override
    public Integer updateAdmin(Admin admin) {
        return adminDao.updateAdmin(admin);
    }

    @Override
    public Admin selectLogin(String name, String password) {
        return adminDao.selectLogin(name);
    }
}
